@extends('admin.layouts.index')
@section('title', '微信支付码生成')

@section('content')

<script src="https://wailiancn.oss-cn-beijing.aliyuncs.com/assets/js/v2/qrcode.min.js?versionId=CAEQIRiBgICI8_PA_RciIDE1ZmZiMmM2NmIyODRmMDE4Mzg0NWM5YTY5OTE5MDI0"></script>
<div class="row">
    <div class="col-md-12">
        <form id="comment-form" method="GET" action="{{ URL::current() }}">
            <div class="card">
                <div class="card-header">
                    <div class="card-title">微信支付码生成</div>
                </div>
                <div class="card-body">
                    <div class="form-group">
                        <label for="text">请输入商品名称:</label>
                        <input type="text" class="form-control" name="body" placeholder="请输入商品名称" value="{{ empty($body) ? '技术服务费' : $body }}">
                    </div>
                    <div class="form-group">
                        <label for="text">请输入收款金额:</label>
                        <input type="text" class="form-control" name="total_fee" placeholder="请输入收款金额" value="{{ empty($total_fee) ? '300' : $total_fee }}">
                        <input type="hidden" name="users_id" value="{{ $users_id }}">
                    </div>
                    <div class="form-group" id="qrcode">
                    </div>
                </div>
                <div class="card-action">
                    <button class="btn btn-primary">生成收款码</button>
                    @if(!empty($out_trade_no))
                    <a class="btn btn-success" href="/admin/pay/wechat_qrcode_status?out_trade_no={{ $out_trade_no }}" target="_blank">查询支付状态</a>
                    @endif
                </div>
            </div>
        </form>
    </div>
</div>
@if(!empty($qrcode_url))
<script type="text/javascript">
    window.onload = function () {
        var qrcode = new QRCode(document.getElementById("qrcode"), {
            text: "{{ $qrcode_url }}",
            width: 120,
            height: 120,
            colorDark : "#000000",
            colorLight : "#ffffff",
            correctLevel : QRCode.CorrectLevel.H
        });
        $("#qrcode").show();
    }
</script>
@endif

@endsection
